2 ==============================================================================
4 This file is part of the JUCE library - "Jules' Utility Class Extensions"
5 Copyright 2004-9 by Raw Material Software Ltd.
7 ------------------------------------------------------------------------------
9 JUCE can be redistributed and/or modified under the terms of the GNU General
10 Public License (Version 2), as published by the Free Software Foundation.
11 A copy of the license is included in the JUCE distribution, or can be found
12 online at www.gnu.org/licenses.
14 JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 ------------------------------------------------------------------------------
20 To release a closed-source product which uses JUCE, commercial licenses are
21 available: visit www.rawmaterialsoftware.com/juce for more information.
23 ==============================================================================
26 #include "../JuceLibraryCode/JuceHeader.h"
27 #include "MainHostWindow.h"
28 #include "InternalFilters.h"
30 #if ! (JUCE_PLUGINHOST_VST || JUCE_PLUGINHOST_AU)
31 #error "If you're building the audio plugin host, you probably want to enable VST and/or AU support in juce_Config.h"
35 ApplicationCommandManager
* commandManager
= 0;
38 //==============================================================================
39 class PluginHostApp
: public JUCEApplication
42 //==============================================================================
51 void initialise (const String
& commandLine
)
53 // initialise our settings file..
55 PropertiesFile::Options options
;
56 options
.applicationName
= "Juce Audio Plugin Host";
57 options
.filenameSuffix
= "settings";
58 options
.osxLibrarySubFolder
= "Preferences";
60 ApplicationProperties::getInstance()->setStorageParameters (options
);
62 commandManager
= new ApplicationCommandManager();
64 AudioPluginFormatManager::getInstance()->addDefaultFormats();
65 AudioPluginFormatManager::getInstance()->addFormat (new InternalPluginFormat());
67 mainWindow
= new MainHostWindow();
68 //mainWindow->setUsingNativeTitleBar (true);
70 commandManager
->registerAllCommandsForTarget (this);
71 commandManager
->registerAllCommandsForTarget (mainWindow
);
73 mainWindow
->menuItemsChanged();
75 if (commandLine
.isNotEmpty() && mainWindow
->getGraphEditor() != 0)
78 if (! commandLine
.trimStart().startsWith ("-psn"))
80 mainWindow
->getGraphEditor()->graph
.loadFrom (File::getCurrentWorkingDirectory()
81 .getChildFile (commandLine
), true);
88 ApplicationProperties::getInstance()->closeFiles();
90 deleteAndZero (commandManager
);
93 void systemRequestedQuit()
96 mainWindow
->tryToQuitApplication();
98 JUCEApplication::quit();
101 const String
getApplicationName() { return "Juce Plug-In Host"; }
102 const String
getApplicationVersion() { return ProjectInfo::versionString
; }
103 bool moreThanOneInstanceAllowed() { return true; }
106 ScopedPointer
<MainHostWindow
> mainWindow
;
110 // This kicks the whole thing off..
111 START_JUCE_APPLICATION (PluginHostApp
)